myApp.controller("userCtrl", ["$scope", "$state", "$http", function($scope, $state, $http){
	$http({
		method: "get",
		url: "/info"
	}).success(function(data){
		console.log(data);
		if(data){
			$scope.user = data;
		}
		if(data == 'error'){
			$state.go("/login");
		}
	});
	$scope.save = function(user){
		$http({
			method: "post",
			url: "/info",
			params: {
				user: user
			}
		}).success(function(data){
			alert("保存成功！");
			$state.reload();
		});
	}
	
	
}]).controller("userPasswdCtrl", ["$scope", "$state", "$http", function($scope, $state, $http){
	$scope.save = function(user){
		$http({
			method: "post",
			url: "/info",
			params: {
				user: user
			}
		}).success(function(data){
			
		}).error(function(data){
			
		});
	}
}]);